<template>
  <div>
    <van-nav-bar
      title="申请教室"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
    />
    <van-form @submit="onSubmit">
      <van-field
        v-model="lessName"
        name="申请日期"
        label="申请日期"
        placeholder="点击选择申请日期"
        :rules="[{ required: true, message: '请选择申请日期' }]"
        @click="onfocus()"
        disabled/>
      <van-dropdown-menu>
        <van-dropdown-item v-model="value1" :options="option1" />
      </van-dropdown-menu>
      <van-field
        v-model="classUnion"
        name="涉及班级"
        label="涉及班级"
        placeholder="涉及班级"
        :rules="[{ required: true, message: '请填写涉及班级' }]"
      />
      <div style="margin: 16px;">
        <van-button round block type="info" native-type="submit">查询</van-button>
      </div>
    </van-form>

    <van-dialog v-model="show" title="申请日期" show-cancel-button>
      <van-datetime-picker
        v-model="currentDate"
        type="date"
        :min-date="minDate"
        :max-date="maxDate"
        confirm-button-text=" "
        cancel-button-text=" "
        show-toolbar=false
      />
    </van-dialog>
  </div>
</template>

<script>
export default {
  created() {
    this.$data.role = this.$route.query.role;
  },
  data() {
      return {
        show: false,
        role:-1,
        lessName: '',
        teachName: '',
        classUnion: '',
        minDate: new Date(2020, 0, 1),
        maxDate: new Date(2025, 10, 1),
        currentDate: new Date(),
        value1: 0,
        option1: [
          { text: '上午', value: 0 },
          { text: '下午', value: 1 },
        ],
      };
    },
    methods: {
      onSubmit(values) {
        console.log('submit', values);
      },
      onClickLeft() {
        this.$router.push({path:'/home',query:{role:this.$data.role}})
      },
      onfocus() {

        this.show = true
      },
      cancel() {
        this.show = false
      },
      confirm(val) {
        this.show = false
      }
    },
}
</script>

<style>
</style>
